package com.zbkj.dal.base.enums;

import com.zbkj.dal.common.exception.CrmebException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@AllArgsConstructor
public enum OrderInvoceStatus {

    /**
     * 物流状态
     */
    ERROR("50", "异常"),

    CANCEL("40", "已取消"),

    WAITING("20", "待揽收"),
    COLLECTED("21", "已揽收"),
    TRANSIT("22", "运输中"),
    DELIVERY("23", "派送中"),
    SIGNED("24", "已签收"),
    COMPLETED("25", "已完成"),


    REROUTING("31", "转寄中"),
    ;

    @Getter
    private final String code;
    @Getter
    private final String desc;


    public static OrderInvoceStatus codeOf(String code) {
        for (OrderInvoceStatus value : OrderInvoceStatus.values()) {
            if (StringUtils.equals(code, value.getCode())) {
                return value;
            }
        }
        throw new CrmebException("不支持的物流状态类型");
    }


}
